package com.nulldev.util.java.extendedUI.cSwing.Fonts;

import java.awt.Font;
import java.awt.GraphicsEnvironment;

import com.nulldev.util.java.swing.font.FontManager;

public class IcoMoon {
	
	private static final Font cached = getFont();
	
	public static Font getCached() {
		return cached;
	}
	
	public static Font getCached(final float size) {
		return cached.deriveFont((float) size);
	}

	public static Font getFont() {
		try {
			final Font result = Font.createFont(Font.TRUETYPE_FONT, IcoMoon.class.getResourceAsStream("IcoMoon-Free.ttf"));
			GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(result);
			return result;
		}catch (Exception e) {
			e.printStackTrace();
			return FontManager.defaultFont();
		}
	}
}
